package jtk.project4.fleet.screen.templateView;

import java.awt.FlowLayout;

import jtk.project4.fleet.field.IdentificationField;
import jtk.project4.fleet.templateField.ContohCalendarField;
import jtk.project4.fleet.templateField.ContohCheckField;
import jtk.project4.fleet.templateField.ContohComboDanSelectField;
import jtk.project4.fleet.templateField.ContohRadioButtonField;
import jtk.project4.fleet.templateField.ContohSpinnerField;
import jtk.project4.fleet.templateField.ContohTableField;
import jtk.project4.fleet.templateField.ContohTextAreaField;
import jtk.project4.fleet.templateField.ContohTextField;
import nl.coderight.jazz.form.FormHeader;
import nl.coderight.jazz.form.FormView;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.button.PushButton;

public class ContohView extends FormView{
	private PushButton submitButton ;
	private PushButton cancelButton ;
	private FormHeader formHeader ;
	
	@Override
	protected void init() {
		createFields();
		createLayout();
		
	}
	
	private void createLayout() {
		setHeader(createHeader());
		addField(createForm());
		setResizable(false);
	}
	private void createFields(){
		submitButton = new PushButton("submitAction");
		cancelButton = new PushButton("cancelAction");
	}
	
	private FormHeader createHeader() {
		formHeader = new FormHeader();
		formHeader.setTitle("nama screen.header.form");
		return formHeader;
	}
	
	private GroupControl createButtons() {
		GroupControl buttons = new GroupControl();
		buttons.setLayout(new FlowLayout(FlowLayout.RIGHT));
		buttons.addField(submitButton);
		buttons.addField(cancelButton);
		return buttons;
	}
	
	private GroupControl createForm() {
		GroupControl form = new GroupControl();
		// disini add Field yang rekan-rekan buat. contoh
		form.addField(new ContohTextField("Identification"), NORTH);
		//form.addField(new ContohTextAreaField("Domain"),CENTER);
		//form.addField(new ContohTableField("Domain"),CENTER);
		form.addField(new ContohComboDanSelectField("Domain"),EAST);
		//form.addField(new ContohCalendarField("tanggal"),CENTER);
		//form.addField(new ContohSpinnerField("domains"), CENTER);
		form.addField(new ContohRadioButtonField("domains"), CENTER);
		//form.addField(new ContohCheckField("domain"),CENTER);
		form.addField(createButtons(), SOUTH);		
		
		return form;
	}
}
